#include <staticOrderTable.h>

int SearchBin(SqTable T, int key){
    int low, high, mid;
    low = 1; high = T.n;
    while (low <= high)
    {
        mid = (low + high) / 2;
        if(key == T.elem[mid].key) return mid;
        else if(key < T.elem[mid].key) high = mid - 1; // 在前半区域查找
            else low = mid + 1; // 在后半区域查找
    }
    // 查找不成功
    return 0;    
}